package cn.song.freight.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MyBatisPlus配置类
 * 用于配置MyBatisPlus的相关功能，主要包括分页插件的配置
 *
 * @author Song~
 * @since 2024-07-20 14:02:12
 */
@Configuration
public class MyBatisPlusConfig {

    /**
     * 配置MyBatisPlus的拦截器
     * 添加分页插件，支持数据库分页查询功能
     *
     * @return MybatisPlusInterceptor 实例
     */
    @Bean
    MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return mybatisPlusInterceptor;
    }

}
